package com.sdk.config;

import com.sdk.utils.InfluxDBConnUtils;
import org.influxdb.dto.BatchPoints;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class InfluxdbConfig {

    @Value("${influxdb.username}")
    private String username;

    @Value("${influxdb.password}")
    private String password;

    @Value("${influxdb.openurl}")
    private String openurl;

    @Value("${influxdb.database}")
    private String database;

    @Bean
    public InfluxDBConnUtils InfluxDBConnUtils() {
        return new InfluxDBConnUtils(openurl, database, username, password);
    }

    @Bean
    public BatchPoints batchPoints(){
        return BatchPoints.database(database)
                .build();
    }
}
